package com.frinder.wx.base.conf;

import com.frinder.wx.base.service.MessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.weixin4j.model.message.OutputMessage;
import org.weixin4j.model.message.normal.TextInputMessage;
import org.weixin4j.spi.DefaultNormalMessageHandler;

/**
 * @ClassName MyNormalMessageHandler
 * @Description 普通消息处理器
 * @Author frinder
 * @Date 2018/12/6 14:25
 * @Version 1.0
 */
@Slf4j
@Component
public class MyNormalMessageHandler extends DefaultNormalMessageHandler {

    @Autowired
    private MessageService messageService;

    @Override
    public OutputMessage textTypeMsg(TextInputMessage msg) {
        log.info("*** 收到 {} 类型消息：{}", TextInputMessage.class, msg);
        return messageService.callTuLing(msg);
    }
}
